package com.xxgc.helloworld.config;

import com.xxgc.helloworld.scheduler.QuartzScheduler;
import org.quartz.SchedulerException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationListener;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.event.ContextRefreshedEvent;

/**
 * @program: helloworld
 * @description: 项目启动开始打工
 * @author: liutao
 * @create: 2022-03-08 19:51a
 **/
@Configuration
public class QuartzStartListener implements ApplicationListener<ContextRefreshedEvent> {
//    @Autowired
//    private QuartzScheduler quartzScheduler;
    //项目启动会调用这个方法
    @Override
    public void onApplicationEvent(ContextRefreshedEvent contextRefreshedEvent) {
//        try {
//            quartzScheduler.startJob();
//        } catch (SchedulerException e) {
//            e.printStackTrace();
//        }
    }
}